package com;

import com.qf.Myconfig.MyRibbonConfig;
import org.checkerframework.checker.units.qual.A;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.client.RestTemplate;

/**
 * @author wbzs,
 * @date 2022/10/20,
 * @time 16:01,
 */
@ComponentScan(excludeFilters = {@ComponentScan.Filter(classes = {A.class})})//凡是类上面有A注解的，都不扫描
@RibbonClient(name="addressprovidereureka04",configuration = MyRibbonConfig.class)//给指定名字的服务设置配置（想有效需要不被main扫描到）
@SpringBootApplication
@EnableEurekaClient
public class EurekaStarer06 {

    public static void main(String[] args) {
        SpringApplication.run(EurekaStarer06.class, args);
    }

    //发起网络请求的工具类
    @LoadBalanced//开启负载均衡，也就是从注册中心里面获取到地址后进行负载均衡
    @Bean
    public RestTemplate restTemplate(){
        return  new RestTemplate();
    }
}
